/* 
 * Copyright 2013 Sébastien Mouquet.
 * 
 * This file is part of ECovoiturage.
 * 
 * ECovoiturage is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * ECovoiturage is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with ECovoiturage. If not, see http://www.gnu.org/licenses/.
 */
package com.smouquet.ecovoiturage.ui.page.root.apropos;

import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.themes.Runo;

/**
 * 
 * @author sebastien.mouquet
 */
public class AProposView extends VerticalLayout implements View
{
    public static final String VIEW_NAME = "apropos";
    
    
    public AProposView() {}
    

    @Override
    public void enter(ViewChangeEvent event)
    {
        Label lbTitle = new Label("ECovoiturage");
        lbTitle.setSizeUndefined();
        lbTitle.addStyleName(Runo.LABEL_H1);
        addComponent(lbTitle);
        setComponentAlignment(lbTitle, Alignment.MIDDLE_CENTER);
        
        Label lbSubtitle = new Label("Une application web conçue pour faciliter et inciter le covoiturage au sein des entreprises");
        lbSubtitle.setSizeUndefined();
        addComponent(lbSubtitle);
        setComponentAlignment(lbSubtitle, Alignment.MIDDLE_CENTER);
        

        addComponent(new Label("<br><br>", ContentMode.HTML));
        
        
        Label lbVersionLong = new Label("Version 1.0 Milestone 2");
        lbVersionLong.setSizeUndefined();
        addComponent(lbVersionLong);
        setComponentAlignment(lbVersionLong, Alignment.MIDDLE_CENTER);
        
        Label lbVersionShort = new Label("(1.0.M2)");
        lbVersionShort.setSizeUndefined();
        addComponent(lbVersionShort);
        setComponentAlignment(lbVersionShort, Alignment.MIDDLE_CENTER);
        

        addComponent(new Label("<br><br>", ContentMode.HTML));

        
        StringBuilder text = new StringBuilder();
        text.append("ECovoiturage est une application open source (licence GNU GPL v3) ");
        text.append("développée dans le cadre du challenge RSE organisé par le Groupe ");
        text.append("Chèque Déjeuner. Les participants, regroupés en équipe, doivent ");
        text.append("soumettre des idées autour de plusieurs thèmes : consommation, ");
        text.append("achats responsables, prévention, amélioration et solidarité. ");
        text.append("Dans le cadre de la mission 'consommation', l'équipe Malte de la ");
        text.append("société Apologic a proposé de nombreuses idées concernant le ");
        text.append("covoiturage. ECovoiturage est une mise en oeuvre de ces différentes idées. ");
        text.append("Retrouvez d'autres informations, de la documentation ou les sources ");
        text.append("en visitant les liens suivants : ");
        
        Label lbPresentation = new Label(text.toString());
        addComponent(lbPresentation);
        setComponentAlignment(lbPresentation, Alignment.MIDDLE_CENTER);
        
        
        addComponent(new Label("<br><br>", ContentMode.HTML));
        
        
        Label lbProjet = new Label("<a href='https://code.google.com/p/ecovoiturage/' target='_blank'>Page du projet</a>", ContentMode.HTML);
        lbProjet.setSizeUndefined();
        addComponent(lbProjet);
        setComponentAlignment(lbProjet, Alignment.MIDDLE_CENTER);
        
        Label lbDocumentation = new Label("<a href='https://code.google.com/p/ecovoiturage/w/list' target='_blank'>Documentation</a>", ContentMode.HTML);
        lbDocumentation.setSizeUndefined();
        addComponent(lbDocumentation);
        setComponentAlignment(lbDocumentation, Alignment.MIDDLE_CENTER);
        
        Label lbIssues = new Label("<a href='https://code.google.com/p/ecovoiturage/issues/list' target='_blank'>Signaler un problème / Proposer une suggestion</a>", ContentMode.HTML);
        lbIssues.setSizeUndefined();
        addComponent(lbIssues);
        setComponentAlignment(lbIssues, Alignment.MIDDLE_CENTER);
        
        Label lbSource = new Label("<a href='https://code.google.com/p/ecovoiturage/source/checkout' target='_blank'>Sources</a>", ContentMode.HTML);
        lbSource.setSizeUndefined();
        addComponent(lbSource);
        setComponentAlignment(lbSource, Alignment.MIDDLE_CENTER);
        
        
        addComponent(new Label("<br><br>", ContentMode.HTML));
        
        
        Label lbCopyright = new Label("Copyright 2013 Sébastien Mouquet", ContentMode.HTML);
        lbCopyright.setSizeUndefined();
        addComponent(lbCopyright);
        setComponentAlignment(lbCopyright, Alignment.MIDDLE_CENTER);
        
        text = new StringBuilder();
        text.append("<br>");
        text.append("ECovoiturage is free software: you can redistribute it and/or modify<br>");
        text.append("it under the terms of the GNU General Public License as published by<br>");
        text.append("the Free Software Foundation, either version 3 of the License, or<br>");
        text.append("(at your option) any later version.<br>");
        text.append("<br>");
        text.append("ECovoiturage is distributed in the hope that it will be useful,<br>");
        text.append("but WITHOUT ANY WARRANTY; without even the implied warranty of<br>");
        text.append("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br>");
        text.append("GNU General Public License for more details.<br>");
        text.append("<br>");
        text.append("You should have received a copy of the GNU General Public License<br>");
        text.append("along with ECovoiturage. If not, see <a href='http://www.gnu.org/licenses/' target='_blank'>http://www.gnu.org/licenses/</a>. ");
        
        Label lbCopyrightTxt = new Label(text.toString(), ContentMode.HTML);
        lbCopyrightTxt.setSizeUndefined();
        addComponent(lbCopyrightTxt);
        setComponentAlignment(lbCopyrightTxt, Alignment.MIDDLE_CENTER);
        
        
        setWidth(100, Unit.PERCENTAGE);
        setMargin(true);
    }
    
}
